Skip to content

Bundle 6/6: screens and advisors - #150

Open
MortenLyhr wants to merge 136 commits into
bssth:masterfrom
MortenLyhr:train/6-screens-advisors
Open

MortenLyhr wants to merge 136 commits into
bssth:masterfrom
MortenLyhr:train/6-screens-advisors

Conversation

@MortenLyhr

@MortenLyhr MortenLyhr commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Clean room (#181): checked on 2026-11-25 against #181's clean-room rules and guides (CONTRIBUTING.md "Clean room", AGENTS.md). This PR was written before #181; its sources are below, in #181's terms.

What it is based on, for each PR this bundle replaces:

PR Based on
#96 the theme's tint; CvScreensInterface.forceScreenUpdate's comment
#107 BUG's init.xml and the game's fonts, Wine
#115 the theme's FactorCombine, Wine
#121 seen in Wine, the scripts
#122 BUG's source (addColoredPlot), Wine
#126 the theme's Grid colour, Wine
#128 measured in Wine; all 15 World Builder buttons hovered in Wine and each text found in the XML; the SDK; BUG
#133 Civ4Theme_Table.thm and Civ4Theme_Custom.thm, Wine
#138 BUG's files, the theme, Wine
#136 Civ4Theme_Separator.thm, Wine
#139 Civ4Theme_Scroll.thm, Wine
#140 measured in Wine
#141 a font sample measured in Wine

This bundle's own commits: Wine pictures of the World Builder's Technologies and Terrains tabs.

Clean room: #120's rule for later autosaves (from #148, which this bundle holds) and #128's World Builder help keys were first taken from the original executable's text. Both were then redone from what the original shows under Wine, the code follows only what was seen there, and the history was rewritten so that no commit carries the executable's text. Nothing else in this bundle comes from a binary.

To do after #181 is merged: kMoveOn = 4, kMoveOff = 5 become 3 and 2 (NOTIFY_CURSOR_MOVE_ON/OFF) when this is rebased on #181, which renumbers NotifyCode; the slider fix comes with #148.


Merge after bundle 5, #149 (this branch holds it; once it is merged, this PR shows only its own changes).

Rebased on master (2026-11-23): bundles 1–3 are merged, so this branch is based on master now; the changes they held are gone from its diff. It holds #148 and #149.

Clean room (2026-11-23): #128's history is rewritten. The commit that took the World Builder buttons' help keys from the executable and the commit that re-checked them in Wine are now one commit, whose message gives only what was seen in Wine. No commit in this bundle carries knowledge from the exe any more. fix/worldbuilder-help (#128's branch) is force-pushed with the same history, and the committed .pyc files are gone from the history.

Fixed 2026-11-23:

  • World Builder, Technologies tab: the techs the player knows have the original's yellow glow (its BUTTON_HILITE_SQUARE highlight), which follows a tech added or taken away (bd2b9ce, 072f8de).

    Wine | before | after:
    techs

  • World Builder, Terrains tab: grouped as the original's, each list on rows of its own (terrains, plot types, features, routes and river), without the graphical-only peak and hill terrains that showed twice (3ccf422).

    Wine | before | after:
    terrains

This PR replaces 13 open PRs, merged here one by one with their own commits (each description stays on its PR, which links here once closed); the conflicts between them are resolved as on the branch we play daily. Merging it closes nothing automatically: each replaced PR will be closed with a link here.

PR What
#96 Tech advisor as the original's: tech colours, choosing and queueing shown
#107 BUG's Foreign Advisor as the original's: attitude icons, panel titles, rows, relation lines
#115 Screens: a screen's own minimap in its widgets' order; panels opaque as the theme says
#121 Screens: scripts hear the mouse go onto a widget and off it; civic buttons as the original
#122 BUG's dot map: placing, removing and drawing city sites as the original
#126 Tables drawn with a grid show the theme's grid lines
#128 World Builder as the original: tooltips, palette help, edit window, diplomacy mode
#133 Tables and list boxes: the theme's rows (alternating, rollover, selected), row heights and background
#138 BUG's Domestic Advisor: its saved pages load; tables look and sort as the original's
#136 Screens: list rows as the original's espionage advisor lays them out
#139 Scroll bars: drag the grip, arrows and paging as the original's
#140 Screens: a widget's help beside it, labels that don't light up, messages under the screens
#141 Screens: setText at the size the original draws it, and determineWidth measures that size

Checks: macOS build (Release), ctest 21/21 passed; sync checksums --turns 100 --map Fractal --size STANDARD --seed 7 at turn 100 equal master's (D7D43800). Windows: this PR's CI.

World Builder buttons' help: re-checked in the running game (2026-11-22, 806a82e7)

#128 had taken each World Builder button's help key from the original's exe, against CONTRIBUTING. All 15 buttons were hovered in the running game under Wine instead (see #128's added section); every shown text is the key we had. No code change; the docstrings name the new source. ctest 22/22, sync checksum D7D43800, as before.

🤖 Generated with Claude Code

MortenLyhr and others added 30 commits November 19, 2026 19:39
With a city's screen up, a click on the map now goes to the game core's
city screen handlers, as the original engine hands them over, instead of
selecting units:

- a click: CvGame::handleCityScreenPlotPicked (a plot of the city's is
  worked or let go; the city's own plot gives the citizens back to the
  governor; a plot outside closes the screen, CITY_SCREEN_CLICK_WILL_EXIT)
- a right click: handleCityScreenPlotRightPicked (the forced choice taken
  away)
- a double click: handleCityScreenPlotDoublePicked (on the city: the
  screen closes)

Plot clicks now say whether they are the second of a double click (SDL's
click count).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The city screen's top panel (Panel_City_Top_Style) spans the whole map
area, but its skin is a frame with an empty middle
(GFC_BITMAPSKIN_CENTER_EMPTY): only its top and sides are drawn. The
interface took every click inside its rectangle, so the city's tiles
could not be clicked. A themed panel now takes a click only where its
skin draws something (Theme::covers, the same pieces Theme::draw puts
down). The main interface's panels take the same clicks as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Selecting a city (its screen) now lets go of the selected units, as the
game core's CvGame::selectUnit lets go of the cities: a unit selected
before stayed selected under the city screen, showed its way on a right
click and could be ordered there. When the screen closes, the game core
selects the next unit that waits (CvGame::updateSelectionList).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…urs and beat

The original draws the button's style (HUD_EndTurn_btn.tga, a brass ring) as it is, and over
it the theme's glass dot (SF_CtrlTheme_Civ4_Control_Button_EndTurn_Skin: HUD_EndTurn.tga at
its size in the middle) with the state's colour added less half (AddSigned). OpenCiv4 tinted
the whole ring instead.

The states were the wrong way round: END_TURN_GO, a steady green dot (EndTurnDot_Green), is
the original's while units can still move; once the turn is over and the end of turn message
is up, the dot is red, sinking from EndTurnDot_Red to EndTurnDot_DarkRed and back. While the
other civilizations move the button is hidden (shouldDisplayEndTurnButton).

The beat, measured in Wine at 120 frames a second: every 1.5 s the red rises over 0.5 s, holds
0.5 s and sinks over 0.5 s; the end of turn message ("Press <ENTER> to end turn...",
"Waiting for other Civilizations...") blinks with it, gone around the darkest red.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…off Windows)

Points gamecore at the openciv4-dll commit that passes L"+"/L"" for %s
in six wide Format calls (backlog: the city bar's defence, building and
religion/corporation help lost their whole text on macOS and Linux).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The options screen asks both; they were unimplemented stubs that logged
each call. There is no debug menu and no dial-up connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine works in the Beyond the Sword folder, so a relative scenario
path no longer pointed at the file ("cannot read the scenario"). A --map
that names an existing file is made absolute with the other command line
paths; a map script's name (Fractal, ...) stays as it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a serif stand-in

The theme (Resource/Themes/Civ4/Civ4Theme_Common.thm) asks for Sylfaen at 12, 14, 16 and 22
for all the interface's text. macOS and Linux lack it, so every text fell back to a sans face.
The game ships it (Resource/Civ4/sylfaen{,b,i,bi}.ttf, Resource/Fonts, Assets/res/Fonts), and a
game in a Wine prefix has the Windows fonts beside it (drive_c/windows/Fonts): Theme::fontFolders
names them and Fonts::addFolders (FreeType) looks there too. No font is copied.

A missing serif family (Sylfaen, Georgia, Times New Roman...) now gets a serif stand-in
(Georgia, Noto Serif, DejaVu Serif, Liberation Serif, Times) before the sans defaults. macOS's
symbol and CJK faces join the per-character fallbacks: the capital's star (U+2605) was a box.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ginal draws it

addMultilineText took a label's rule (the game font: size 2, 14 px); the original draws it in the
GFC control's normal font, Civ4Theme_Common.thm's .Normal = Size3_Normal, as it does setText.
Measured on Dawn of Man's body against the original: word spacing and line breaks now match.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BUG's city cycle arrows by the minimap (MainCityScrollMinus/Plus, WIDGET_CITY_SCROLL)
and the Home/End keys run CONTROL_NEXTCITY/PREVCITY. With no city selected the game
core asks the interface's selectLookAtCity, which was a stub, so they did nothing on
the map. Now it selects the active player's city nearest the plot the camera looks
at (as a selection, not the city screen); later presses cycle on from it
(CvGame::cycleCities). getLookAtPlot gives that plot, and getSelectionPlot is the
selected city's plot while cities are selected, so lookAtSelectionPlot moves the
camera there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The original keeps four of the toggles by the minimap in its player
profile (Profiles/<name>.pfl, named by CivilizationIV.ini's UserProfile):
the plot grid, the bare map, the yields and the scores, as CyUserProfile's
getGrid, getMap, getYields and getScores. It writes the file at each click,
and every game takes them from there: after a restart, a new game, and a
loaded save (a save made with the grid on loads with the profile's grid).
The unit and resource icon layers are not kept. (Watched in Wine.)

OpenCiv4 now keeps them in its own profile (Documents/My Games/openciv4/
profile.ini) as grid=, map=, yields=, scores=: oc4options gives them to the
host when the profile is read, and Screens::frame tells it when one is
switched, by its button or its key. The scores toggle works (it did
nothing, and the scores showed always), and CyUserProfile / CyInterface
read the toggles as they are.

New test minimap_toggles (oc4options with a stand-in host): a switched
toggle is in profile.ini at once and comes back after a restart and with
readFromFile; an older profile gives the defaults.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… OpenCiv4's own options on their own tab

The original keeps the player options in its player profile and sends them to the
active player at the start of every game, new or loaded (CvGame::sendPlayerOptions);
OpenCiv4 used the XML's defaults for a new game and the save's own after a load, and
never wrote them to profile.ini. Now Utility holds the profile's (profile.ini player.N),
a choice sent from the options screen goes into it and is written at once.

The options screen's check boxes get the theme's GFC_Control_StandardCheckBox_Style, as
the custom game screen's; W A S D, idle turns and edge scrolling move to an OpenCiv4 tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rges cleanly with bssth#85)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ly with bssth#85)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…abs, GFC's box layout

Measured on the original's options screen (Wine, BUG + BULL): the standard window's title bar
with the title at the left, tabs as wide as their words from the left (the theme's tab skins,
the chosen one lighter, a baseline under them), 31 px rows (GFC's default control height),
16 px text, a box's children as wide as they need with the rest to those that expand (the
two columns of player options) or to the spacers (Language at the panel's foot), Restore
Defaults and Exit centred under the panel. Empty panels take no room. CyGTabCtrl's
setActiveTab/getActiveTab work, so a script can open a tab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…first

The original shows the game's messages in a see-through black box under the top
bar (606 wide in the middle, a line of 18 for each), newest at the top, at most
six; each line has a bullet and is drawn in the message's flash colour (BUG's
foreign city founded in magenta, losses in red, white when it has none), colours
in its text kept. A line shows at once and goes at once when its time is up; one
pushed out by newer ones does not come back. Measured in Wine (BUG + BULL) from
a film of the window at 1600 x 900.

OpenCiv4 drew centred lines without a box, all white, oldest first, fading over
their last second, up to twelve.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hown

Three pieces, found with BUG's tech advisor in Wine (BUG + BULL):

- A panel's colour from setPanelColor tints the layers its theme style tints by the
  panel's own inner colour (FactorColor GFC_Control_Panel_Color_Inner, Modulate):
  Panel_Tech_Style's tech_panel01. Known techs are green, the one researched and
  the queued cyan, the others blue, as in the original; they were all blue.
- The tech advisor is told when the active player's research changes (a tech
  clicked, Shift-clicked into the queue, learnt, a new turn), as the original
  engine calls CvScreensInterface.forceScreenUpdate for it, and redrawn when it
  comes up (the turns left show at once). A click did choose the tech, but the
  screen never showed it.
- addScrollPanel draws no panel: the engine's GScrollPanel is transparent
  (Civ4Theme_ScrollPanel.thm, GFC_CF_TRANSPARENT). The techs lie on the
  advisor's parchment, not the external style's blue; the city screen's right
  column loses a blue block Wine does not have.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the border

Measured against the original (BUG + BULL, the new civic popup, 1600 x 900):

- Each choice (popupAddGenericButton) is the theme's standard stone button across
  the window, its text dark with the button's light shadow, 9 in; a line's button
  is 25 high, 6 apart; the first has the focus rim until the keys choose another.
  They were plain white text lines.
- The theme's GFC_BITMAPSKIN_SIDES_FILL is read: a window border's sides are
  filled with its colour round the glass, which is drawn inside the border's
  margin (12, 13, 12, 15). The glass's light top now follows on from the
  border's, as in the original; it was a hard light band with a darker step.
  (A pull down's open list keeps its look: its inner skin is drawn under the
  whole border.)
- The window sits where the original's does (rim at 1182, 79).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…owed

Before the player options were kept as choices, the options screen wrote
every player option it had shown, and it showed those the profile did not
have as off. Such a profile has Wait at End of Turn off (and advisor
pop-ups, Sid's tips) though the player never chose it; with Wait at End of
Turn off the game core ends each turn by itself once a unit has moved, so
turns seemed to end on their own.

The profile now has a version (2). One without it gets, once, the XML's
default for the options that are on by default and off there; every other
choice stays, and from then on off is the player's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The city screen lets go of the selected units (so a right click on it
orders nothing), and when it closed the game core picked the next unit
that waited, or none: the unit the player had before was gone. The
units selected when the screen opened are now kept and selected again
when it closes (those still there and the player's), as the original
keeps them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Esc cancels

With a unit selected and the right button held on another plot, the
original shows the way there and the unit's action buttons for that plot,
those recommended there glowing (a worker: the farm, road, cottage it
should build there; CvUnit::isActionRecommended and
CvGame::canHandleAction read the interface's goto plot). Esc lets go of
the way, and the button's release then orders nothing.

- The goto plot changing marks the action buttons for redrawing, so the
  main interface asks again for that plot.
- enableMultiListPulse works: a pulsing button has the original's blue
  rim and tint, a little brighter and dimmer a second a beat (measured
  in Wine). It shows for the unit's own plot too, as the original's.
- Esc with the right button held cancels the way and the order.
- --keys can move the mouse ("?<x,y>") and hold the right button
  ("/<x,y>", "\<x,y>"), to test drags through the window's own input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…link)

oc4core links the game core through its import library on Windows, where only
its exported functions can be called; CvTeam::isHasTech, getResearchProgress,
CvPlayer::getQueuePosition, calculateResearchRate and
CvGlobals::getNumTechInfos are not (LNK1120 on windows-x64). The research state
the tech advisor is told about is now read by oc4screens.researchState through
the scripts' CyPlayer and CyTeam, as a string compared each frame. The same
values, the same behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…75's where GameFont has none

BUG draws its attitude faces, war and peace icons as font cells by their offset from a symbol
the DLL names (init.xml, FontUtil.addOffsetSymbol), and only BUG's GameFont_75.tga holds them.
The original shows them (BUG's foreign advisor GLANCE tab, its INFO attitudes, the espionage
screen, the scoreboard); OpenCiv4 mapped only the DLL's own codes and read GameFont.tga only,
so they were blank.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l's height, lines under buttons

Measured against the original (BUG's foreign advisor, Wine at 1600x900):
- A panel's title is drawn over its box, 11 px in, the box 28 px down ("Surplus Resources",
  the ACTIVE tab's leaders' names); it was not drawn at all.
- The panels in a vertical panel's flow share its free height (GLANCE, ACTIVE, INFO rows).
- In a row, attachTextGFC texts and 46 px buttons sit in cells at least 46 wide, 18 apart,
  in the row's middle (INFO's columns under their headers); BUTTON_SIZE_CUSTOM is as high as
  the row (ACTIVE's leaders).
- A label of spaces is as wide as they are, and labels never take the rest of a row (ACTIVE's
  "   " pushed the leader and the deals out of the row).
- addLineGFC lines are a pixel wide and drawn on their draw control, under the widgets made
  after it (RELATIONS: the lines run under the leaders' buttons).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s it

As the original (Wine, BUG + BULL): a double click on one's city or its
name bar opens the city screen, a single click on the bar selects the
city (what it builds in the bottom panel), and a single click on the
city's plot is any plot's (its units, else nothing). OpenCiv4 opened the
screen on any single click.

The single click stays as an OpenCiv4 option, "Open a city with a single
click" on the options' OpenCiv4 tab (off; cityOneClick in profile.ini).
Clicks carry whether they hit a city's bar, and --keys has "*<x,y>" for
a double click.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sabled, pulse

The unit's actions and the city's builds (GFC multi lists) were bare pictures with a gold
square under the mouse. The original lays the theme's MultiList_Item skins
(Civ4/Custom/MultiListItem.tga) over each: a rounded ring in the HUDBorder colour; under
the mouse the fill glow added (+57 of 255, with a soft edge just outside the ring); pressed,
a blue fill half over it; disabled, everything inside the ring half way to black (not the
theme's ItemDisable, a white wash); the recommended action's pulse a ring going from a
deep to a light blue every 0.6 s, a blue halo outside and a little blue inside. The
buttons are 48 wide, one every 50 (2 apart, across and down). All measured in Wine (BUG +
BULL, 1600x900).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… FactorCombine

The military advisor (BUG) keeps the DEPLOYMENT tab's map and its panel when it
switches to SIT-REP or STRATEGIC ADVANTAGES; in the original the tab's panel,
made after them, covers both. OpenCiv4 drew a screen's own minimap over all its
widgets: it is now drawn where initMinimap / bringMinimapToFront placed it among
them, and left out (with its clicks) when a later panel covers it whole.

The covering panel is PANEL_STYLE_MAIN, whose theme layers say
FactorCombine = GColorCombine(Modulate, Source): the colour tints, the alpha is
the image's own. The theme took the tint's alpha too, so the panel let the
map's box and the background show through; it is opaque now, as in Wine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The original draws a help area with no art of its own (CvMainInterface's
setHelpTextArea(350, ..., "", ..., 300)) in PANEL_STYLE_HUD_HELP:
help_panel.tga tinted HelpBG (69,93,156) at 35 %, the map seen through it,
a dark line and a faint blue one at its top and bottom, the text 4 in from
its sides, wrapped at the area's minimum width (300). The city screen's
area has art (POPUPS_BACKGROUND_TRANSPARENT) and keeps the framed tooltip.
The plot's help sits in the same box. Measured in Wine (BUG + BULL,
1600x900): out = 0.65 map + (8,13,19), as the panel gives.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MortenLyhr

MortenLyhr commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks, you're right. After #128 the map mode left Terrains and Territory out of the strip. You could only reach them through two small < > text arrows, which were easy to miss.

Fixed in 5ae664a3 and fe326216 (in the bundle as 6510608). The map mode's tab strip now works like the original's:

  • The next tab shows, cut off. The tab after the last whole one (Terrains) is drawn up to the arrows, narrowed so its end shows, and its word is cut there. You can click it. Seen in Wine at 1600 x 900: Terrains ends at x 272.
  • The arrows are the original's. They are the theme's tab arrows (SF_CtrlTheme_Civ4_Control_Tab_Arrow_Left/RightButton_Style in Civ4Theme_Tab.thm, art Civ4/tab_arrows.tga), 12 x 25 each at the end of the strip. An arrow with nothing more that way is grey and does nothing. At the start < is grey and > white, as in Wine.
  • Where the strip ends. It runs to 13 px from the window's edge. Only when the tabs don't fit does it keep 30 px for the arrows (the theme's End_Arrow_Indent): 302 − 30 = 272, the cut seen in Wine. Player mode's tabs fit, so it has no arrows, as in Wine.
  • Arrows: one click on > moves the strip by one tab, so it shows Bonuses, Terrains and Territory. Territory is then whole, so > turns grey and < white. More clicks on > do nothing; one click on < moves it back. Seen in Wine.
  • Clicking the cut tab selects it and moves the strip one tab, so it shows whole. Seen in Wine: clicking the cut Terrains selects it and shows Bonuses, Terrains, Territory.
  • Window width: 315, the same in player and map mode. Seen in Wine: the frame's light line is at x 313 in both. Before, it was 318.

Checked in OpenCiv4: > and < scroll both ways, and each tab (Improvements, Bonuses, Terrains, Territory) shows its items. Checked in OpenCiv4 too: clicking the cut Terrains selects it and moves the strip to Bonuses, Terrains, Territory with > grey, as in Wine; one click on < moves it back. ctest passes (23/23 on the bundle), and the checksum at turn 100 is unchanged (D7D43800).

Wine | before | after:
map mode tabs

🤖 Generated with Claude Code

MortenLyhr and others added 3 commits November 23, 2026 10:12
…de page

On Windows, Python 3's text-mode open() uses cp1252, so writing a profile named 東京
raised UnicodeEncodeError (windows-x64 CI, options_other). The files are now opened in
binary mode with the text encoded as UTF-8, and read back the same way, under the
game's Python 2.7 and the tests' Python 3 alike.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MortenLyhr and others added 4 commits November 23, 2026 16:24
…al's

Selecting a city let go of the selected units and selected them again
when its screen closed. The original keeps them: with a warrior selected,
CyInterface().selectCity opens Roma's screen and the warrior is still the
head of the selection (seen in Wine, BtS 3.19). selectCity now leaves the
selection as it is, and the saved list and its restore are gone.

The units take no orders under the screen: CvGame::canHandleAction
refuses a unit's action while a city is selected (its "XXX hack!"), which
also keeps their buttons off the bottom panel, and the screen's clicks
already go to the city (CvGame::handleCityScreenPlot*Picked).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the city screen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since the selected units stay selected under the city screen, the
numpad's digits moved them there: the host moves the head unit itself
(selectionListMove), past CvGame::canHandleAction, which refuses the
units' actions while a city is selected. In the original the numpad does
nothing on the city screen opened with a unit selected, and after Esc the
unit is still selected and moves (seen in Wine, batch 3). Under the city
screen the numpad's digits now do nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…y screen

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MortenLyhr and others added 6 commits November 23, 2026 19:35
At the start, _applyGraphics sent the profile's options to the host in one try. This bundle's
host has no set_city_one_click (it comes with the city double click), so the call failed there
and Keep attacker and Quick enemy moves from profile.ini never reached the host until the options
screen set them. Each call now has its own try, so a host without one of them still gets the rest.

player_options_test: a host without set_city_one_click still gets the options after it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…on its own

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…faults and Exit

The OpenCiv4 tab's panel ran to the bottom of the window, with no line and no buttons under it. It
now has the foot the game's own tabs have (CvOptionsScreen.py: a separator, then a centred row with
Restore Defaults and Exit). Its options are in a scroll panel above that, as the game's Other tab
does, since they don't all fit above the buttons.

Restore Defaults on this tab sets OpenCiv4's options (the tab's check boxes and the
CivilizationIV.ini numbers) back to a new profile's, saves the profile and sends them to the host.
That is what the game's button does for its own tab's options
(CvOptionsScreenCallbackInterface: resetOptions for that tab, refresh, saveProfile). The other
tabs' options are kept. Exit is the game's own handleExitButtonInput.

setText on an edit box now changes the box as shown too: a redraw keeps what was typed into it, so
the reset numbers would have been typed over by the old ones.

player_options_test: the tab's foot, and Restore Defaults there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d Exit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…faults and Exit

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MortenLyhr and others added 7 commits November 23, 2026 20:41
With a worker selected and the right button held over another plot, the action buttons showed what
the worker could do on its own plot. The glow was already the goto plot's (CvUnit::isActionRecommended
reads it), so on a hill the Cottage glowed and no Mine showed. The scripts' action list
(ui_actions_to_show, CyInterface().getActionsToShow) and ui_can_handle_action now pass the
interface's goto plot to CvGame::canHandleAction, which takes it for the mission plot. Without a
held button there is no goto plot, and the core uses the unit's own plot as before.

Seen in Wine (BUG + BULL, a worker at 81,71, the right button held without letting go): on a hill,
Mine and Windmill; on iron on flat grassland, Mine (glowing); on marble, Quarry (glowing); on its own
plot, its own list. The buttons change while the button is still held, before any move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the right button is held

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…original's

The city screen's help area is floating (CvMainInterface.py: setHelpTextArea(390, ..., 0, 0, ...,
bFloating True, the transparent popup art, ...)). OpenCiv4 ignored bFloating and drew every help at
the area's 0, 0, the screen's top-left, over the top bar: the hurry button's at the bottom right
showed its help in the far corner.

A floating help area now puts the help beside the widget under the mouse. Seen in Wine (BUG + BULL,
Roma's city screen at 1600x900, the mouse on the hurry button, Production Automation, a build in the
list and a specialist): the box's right edge is at the widget's left, and its top is at the
widget's top. When that would run off the screen below, its bottom is at the widget's bottom
instead (the hurry button's). It is as wide as its widest line and wraps at about 240 (the hurry
help's longest line, 234 wide, then a break before "a Building"). The main interface's help area
on the map isn't floating and is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… its widget

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	apps/oc4core/Screens.cpp
#	src/render/MapWindow.cpp
#	src/render/MapWindow.h
#	src/render/UiLayer.cpp
#	src/render/UiLayer.h
… peak and hill

The Terrains tab listed every terrain in the XML, the graphical only peak and hill too, so those
two showed twice (once more as the plot types). It also ran its four lists together, eight to a
row. As in the original, seen in Wine (BUG + BULL, Map Mode's Terrains tab), it now shows four
groups, each starting a new row:
- the terrains without the graphical only ones (grass, plains, desert, tundra, snow, coast, ocean);
- the plot types (peak, hills, flat, water);
- the features (ice, jungle, oasis, flood plains, the three forests, fallout);
- the routes and the river.
TERRAIN_PEAK and TERRAIN_HILL are the ones with bGraphicalOnly 1 (CIV4TerrainInfos.xml); they
are the last two, so the other terrains keep their indexes.

The other tabs were checked against the Wine pictures (Units, Buildings, Technologies,
Improvements, Bonuses) and were already in the original's order and rows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…iginal's

On the player mode's Technologies tab the original frames each tech the player knows in yellow
(seen in Wine, BUG + BULL: wine-wb/pl-techs.png). OpenCiv4 marked them with the faint HUD help
panel behind the button, which hardly showed. A known tech is now an image check box that is on,
the way the World Builder's chosen tool button is drawn (its picture and the yellow frame, as in
Wine). The palette reads CyTeam.isHasTech each time it draws, so the frame follows a tech added
or taken away with the brush at once (checked: a click on a known tech takes it away and its
frame goes).

The other lists keep their look: in Wine the units', buildings', terrains' and the rest's chosen
item has no frame.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The frame on the techs the player knows was the theme's toggled look, paler and thinner than the
original's. It is now the art the original uses for it: the check box's highlight picture
BUTTON_HILITE_SQUARE (Art/Interface/Buttons/Button_SELECT.dds, CIV4ArtDefines_Interface.xml),
which CvWorldBuilderScreen.py gives its tool buttons' check boxes. Drawn over the tech's button
when it is on, it gives the bright yellow glow seen in Wine (BUG + BULL, wine-wb/pl-techs.png).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MortenLyhr added a commit to MortenLyhr/openciv4 that referenced this pull request Nov 23, 2026
…#149's)

In bundle bssth#149 "!<x,y>" in --keys already holds the left button
(onPopup() lists it), so '!' would clash there. '&' is free on bssth#149 and
bssth#150.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants